<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>
<script>
    var climbStairs = function (n) {
        let count = 0;
        if (n == 1) {
            count = 1;
        } else if (n == 2) {
            count = 2;
        } else {
            //第一次走一步，有climbStairs(n-1)种方法，第二次走两步，有climbStairs(n-2)种方法
            count = climbStairs(n - 1) + climbStairs(n - 2);
        }
        return count;
    };
    let n = 3;
    console.log(climbStairs(n));
</script>

</html>